// https://www.acwing.com/problem/content/850/

#include <iostream>
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;

const int MAX_N = 100010;

unordered_set<int> nodes;
vector<vector<int>> G(MAX_N);
vector<int> visited(MAX_N);
bool valid = true;
vector<int> ans;

void dfs(int idx) {
    visited[idx] = 1;
    for (const auto v: G[idx]) {
        if (visited[v] == 0) {
            dfs(v);
        } else if (visited[v] == 1) {
            valid = false;
            return;
        }
    }
    ans.push_back(idx);
    visited[idx] = 2;
}

int main() {
    int m, n;
    int a, b;
    scanf("%d%d", &n, &m);
    for (int i=0; i<m; i++) {
        scanf("%d%d", &a, &b);
        G[a].push_back(b);
        nodes.insert(a);
    }

    for (auto v: nodes) {
        if (visited[v] == 0) {
            dfs(v);
        }
        if (!valid) {
            break;
        }
    }

    if (!valid) {
        printf("-1");
        return 0;
    }

    if (ans.size() == n) {
        for (int i=n-1; i>=0; i--) {
            printf("%d ", ans[i]);
        }
    }
    return 0;
}
